﻿@model GitCandy.Models.RepositoryModel

@{
    ViewBag.Title = String.Format(SR.Shared_TitleFormat, SR.Repository_CreateTitle);
    var owners = ViewBag.Owners as IDictionary<String, String>;
}

<h3>@SR.Repository_CreateTitle</h3>


@using (Html.BeginForm("Create", "Repository", FormMethod.Post))
{
    <dl class="dl-horizontal col-md-8">

        <dt>@Html.DisplayNameFor(s => s.Owner)</dt>
        <dd>@Html.DropDownListFor(s => s.Owner, owners.Select(e => new SelectListItem { Value = e.Key, Text = e.Value }), new { @class = "form-control" })</dd>
        <dd>
            <span class="text-danger">
                @Html.ValidationMessageFor(s => s.Owner)
            </span>
        </dd>

        <dt>@Html.DisplayNameFor(s => s.Name)</dt>
        <dd>@Html.TextBoxFor(s => s.Name, new { @class = "form-control" })</dd>
        <dd>
            <span class="text-danger">
                @Html.ValidationMessageFor(s => s.Name)
            </span>
        </dd>

        <dt>@Html.DisplayNameFor(s => s.IsPrivate)</dt>
        <dd>
            <div class="switch" data-on-label="@SR.Shared_Yes" data-off-label="@SR.Shared_No">
                @Html.CheckBoxFor(s => s.IsPrivate, new { data_size = "small" })
            </div>
        </dd>

        <dt>@Html.DisplayNameFor(s => s.AllowAnonymousRead)</dt>
        <dd>
            <div class="switch" data-on-label="@SR.Shared_Yes" data-off-label="@SR.Shared_No">
                @Html.CheckBoxFor(s => s.AllowAnonymousRead, new { data_size = "small" })
            </div>
        </dd>

        <dt>@Html.DisplayNameFor(s => s.AllowAnonymousWrite)</dt>
        <dd>
            <div class="switch" data-on-label="@SR.Shared_Yes" data-off-label="@SR.Shared_No">
                @Html.CheckBoxFor(s => s.AllowAnonymousWrite, new { data_size = "small" })
            </div>
        </dd>
        <dt>@Html.DisplayNameFor(s => s.HowInit)</dt>
        <dd>
            <div class="btn-group" data-toggle="buttons">
                <label class="btn btn-primary" data-repo-init="None">
                    <input type="radio" autocomplete="off">@SR.Shared_None
                </label>
                <label class="btn btn-primary" data-repo-init="Import">
                    <input type="radio" autocomplete="off">@SR.Repository_Import
                </label>
            </div>
            @Html.TextBoxFor(s => s.HowInit, new { @class = "hide" })
            <div class="collapse" data-repo-init="Import">
                <div class="well">
                    <div>@Html.DisplayNameFor(s => s.RemoteUrl)</div>
                    @Html.TextBoxFor(s => s.RemoteUrl, new { @class = "form-control", placeholder = "http(s)://" })
                    <p class="text-warning">@SR.Repository_ImportTips</p>
                </div>
            </div>
        </dd>

        <dt>@Html.DisplayNameFor(s => s.Description)</dt>
        <dd>@Html.TextAreaFor(s => s.Description, 4, 0, new { @class = "form-control" })</dd>
        <dd>
            <span class="text-danger">
                @Html.ValidationMessageFor(s => s.Description)
            </span>
        </dd>

        <dt></dt>
        <dd>@Html.ValidationSummary(false, null, new { @class = "alert alert-dismissable alert-danger" })</dd>

        <dt></dt>
        <dd>
            <button type="submit" class="btn btn-primary">@SR.Shared_Create</button> &nbsp;
            <button type="reset" class="btn btn-inverse">@SR.Shared_Reset</button> &nbsp;
        </dd>
    </dl>
}
